import pickle

def save(str1,str2,count):
        boy_name = 'boy_' +str(count) +'.txt'
        girl_name = 'girl'+str(count) +'.txt'
        boy = open(boy_name,'wb')
        girl = open(girl_name,'wb')
        pickle.dump(str1,boy)
        pickle.dump(str2,girl)
        boy.close()
        girl.close()

def split(x):
    f1 = open('record.txt')
    str1=[]
    str2=[]
    count =1
    for i in f1:
        if i[0:2] !=  '==':
            (name,speak) = i.split(':',1)
            if name == '小甲鱼':
                str1.append(speak)
            else :
                str2.append(speak)
        else :
            save(str1,str2,count)
            count +=1
            str1=[]
            str2=[]
    save(str1,str2,count)
    
    f1.close()

split('record.txt')
